package com.example.myapplication.slice.slice;

import ohos.media.audio.AudioCapturer;
import ohos.media.audio.AudioCapturerInfo;
import ohos.media.audio.AudioStreamInfo;
import ohos.media.audio.SoundEffect;
import java.util.UUID;


public class AudioManager {
    private AudioStreamInfo audioStreamInfo;
    private AudioCapturer audioCapturer;
    private AudioCapturerInfo audioCapturerInfo;
    //packageName 包名

    //在 init 函数中进行 audioCapturer 的初始化，在初始化时对音效进行设置，默认为降噪模式
    public void init(String packageName) {
        this.init(SoundEffect.SOUND_EFFECT_TYPE_NS,packageName );
    }
    //soundEffect 音效uuid
//packageName 包名
    public void init(UUID soundEffect, String packageName) {
        if (audioCapturer == null || audioCapturer.getState() == AudioCapturer.State.STATE_UNINITIALIZED)
            audioCapturer = new AudioCapturer(this.audioCapturerInfo);
        audioCapturer.addSoundEffect(soundEffect, packageName);
    }


}
